//七牛云配置
const qiniu = require('qiniu')
 
// 创建上传凭证
const accessKey = 'xoztEp6nuHJ_MAL1ztnHy84YUeB8tdsKnNq5wJaZ'
const secretKey = 'MDPH_rbS97npB80gZF-MCMjW4fDdDGyvBYXjcrC4'
const mac = new qiniu.auth.digest.Mac(accessKey, secretKey)
const options = {
  scope: 'szuet',
  expires: 1650526915
}
const putPolicy = new qiniu.rs.PutPolicy(options)
const uploadToken = putPolicy.uploadToken(mac)
const key = null
const config = new qiniu.conf.Config();
const bucketManager = new qiniu.rs.BucketManager(mac, config);
const privateBucketDomain = 'http://file.szuet.ltd';
const deadline = parseInt(Date.now() / 1000) + 36000; // 1小时过期
const privateDownloadUrl = bucketManager.privateDownloadUrl(privateBucketDomain, key, deadline);

module.exports = {
  uploadToken
}